<?php
namespace app\index\home;
use app\index\home\Base;
use think\Db;
class Api extends Base
{
    protected function initialize()
    {
       parent::initialize();
       
    }

    function index(){
        // echo 666;
        $rs = file_put_contents('test.txt','123');
        var_dump($rs);exit;
    }

    function test(){
        $starttime = explode(' ',microtime());  
        echo microtime(); 
        echo "<br />";
        $where[] = ['code','like','%0%'];
        $rs = Db::name('ele')->where($where)->limit(20)->select();
        echo Db::name('ele')->getLastSql();
        echo "<br />";
        echo "查询结果数：".count($rs);
        echo "<br />";
        $endtime = explode(' ',microtime());  
        $thistime = $endtime[0]+$endtime[1]-($starttime[0]+$starttime[1]); 
        $thistime = round($thistime,3);  
        echo "本网页执行耗时：".$thistime." 秒。".time(); 
    }
}
?>